package org.simpleframework.mvc.render.impl;

import javax.servlet.http.HttpServletResponse;

import org.simpleframework.mvc.RequestProcessorChain;
import org.simpleframework.mvc.render.ResultRender;

/**
 * 内部异常渲染器
 * @author icanci
 * @date Created in 2021/03/06 21:38
 * @version 1.0
 */
public class InternalErrorResultRender implements ResultRender {
    /**
     * 错误信息
     */
    private String errorMsg;

    /**
     * 构造函数
     * @param errorMsg 错误信息
     */
    public InternalErrorResultRender(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    @Override
    public void render(RequestProcessorChain requestProcessorChain) throws Exception {
        requestProcessorChain.getResponse().sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, errorMsg);
    }
}
